<template>
	<div>
		<a href="/#/Mydb"> <el-button type="success" plain style="float: left;">列表页面</el-button></a>
<el-form :model="dataForm" status-icon ref="dataForm" label-width="100px" class="">
  <el-form-item label="姓名" prop="name">
    <el-input type="test" v-model="dataForm.b_name"></el-input>
  </el-form-item>
  <el-form-item label="密码" prop="checkPass">
    <el-input type="password" v-model="dataForm.b_pwd"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="submitForm()">立即修改</el-button>
    <el-button @click="resetForm('dataForm')">重置</el-button>
  </el-form-item>
</el-form>
</div>
</template>
<script>
  export default {
    data() {  
      return {
		dataId: this.$route.params.id,
        dataForm: {
          b_name:this.$route.params.b_name,
          b_pwd:this.$route.params.b_pwd,
        }
       }; 
    },
    methods: {
      submitForm() {
		  var _this=this;
        _this.$ajax.put('http://1319.cc/fa/'+ _this.dataId,_this.dataForm)
          .then(function (response) {
            console.log(response);
			alert(response.data.msg);
			if(response.data.code==0){
				_this.$router.push({name:'Mydb'});
			}
          })
          .catch(function (error) {
            console.log(error);
          });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
</script>
